package com.example.service.abstractfactory.factoryimpl;

import com.example.service.abstractfactory.AbstractFactory;
import com.example.service.abstractfactory.ColorService;
import com.example.service.abstractfactory.impl.BlueServiceImpl;
import com.example.service.abstractfactory.impl.RedServiceImpl;

/**
 * @author ChenXiaoBin
 * on 2020-07-28
 */
public class ColorFactory extends AbstractFactory {
    @Override
    public ColorService getColor(String color) {
        if (("red").equals(color)) {
            return new RedServiceImpl();
        }
        if (("blue").equals(color)) {
            return new BlueServiceImpl();
        }
        return null;
    }
}
